/*    */ package net.sourceforge.appgen.support;
/*    */ 
/*    */ import net.sourceforge.appgen.model.Field;
/*    */ import org.eclipse.jface.viewers.CellEditor;
/*    */ import org.eclipse.jface.viewers.ColumnViewer;
/*    */ import org.eclipse.jface.viewers.EditingSupport;
/*    */ import org.eclipse.jface.viewers.TableViewer;
/*    */ import org.eclipse.jface.viewers.TextCellEditor;
/*    */ 
/*    */ public class FieldColumnLengthEditingSupport extends EditingSupport
/*    */ {
/*    */   private CellEditor editor;
/*    */ 
/*    */   public FieldColumnLengthEditingSupport(ColumnViewer viewer)
/*    */   {
/* 36 */     super(viewer);
/*    */ 
/* 38 */     this.editor = new TextCellEditor(((TableViewer)viewer).getTable(), 131072);
/*    */   }
/*    */ 
/*    */   protected boolean canEdit(Object element)
/*    */   {
/* 43 */     return true;
/*    */   }
/*    */ 
/*    */   protected CellEditor getCellEditor(Object element)
/*    */   {
/* 48 */     return this.editor;
/*    */   }
/*    */ 
/*    */   protected Object getValue(Object element)
/*    */   {
/* 53 */     Field field = (Field)element;
/*    */ 
/* 55 */     return String.valueOf(field.getColumnSize());
/*    */   }
/*    */ 
/*    */   protected void setValue(Object element, Object value)
/*    */   {
/* 60 */     Field field = (Field)element;
/*    */     try
/*    */     {
/* 63 */       int columnLength = Integer.parseInt(String.valueOf(value));
/*    */ 
/* 65 */       field.setColumnSize(columnLength);
/*    */     }
/*    */     catch (NumberFormatException localNumberFormatException) {
/*    */     }
/* 69 */     getViewer().update(element, null);
/*    */   }
/*    */ }

/* Location:           C:\Users\lzl6066\Downloads\net.sourceforge.appgen_1.2.0\plugins\net.sourceforge.appgen_1.2.0.201002031718\
 * Qualified Name:     net.sourceforge.appgen.support.FieldColumnLengthEditingSupport
 * JD-Core Version:    0.6.0
 */